
class Solution {
public:
    int minMovesToCaptureTheQueen(int a, int b, int c, int d, int e, int f) {
        auto move = [&](auto& fun, int x, int y, int chx, int chy) {
            if (x <= 0 || y <= 0 || x > 8 || y > 8)
                return 0;
            if (x == a && y == b)
                return 1;
            if (x == c && y == d)
                return 2;
            return fun(fun, x + chx, y + chy, chx, chy);
        };
        int x = move(move,e,f,1,1) + move(move,e,f,-1,1) + move(move,e,f,1,-1) + move(move,e,f,-1,-1);
        int y = move(move,e,f,0,1) + move(move,e,f,1,0) + move(move,e,f,0,-1) + move(move,e,f,-1,0);
        if((x & 2) ||( y & 1)){
            return 1;
        }else{
            return 2;
        }
    }
};